From bd2f982c489b15ce1165c051fdedf35af979f784 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Tue, 8 Sep 2026 17:06:51 +0200 Subject: Migrate date handling from Date to Temporal API Routine scheduling, health series, service stamps, session expiry, and date formatting move to native Temporal (Instant / ZonedDateTime in UTC), with ISO strings kept at DB and chart boundaries. Ambient types in src/temporal-ambient.d.ts cover the native runtime; no polyfill. Observable behavior and stored formats are unchanged. --- src/routes/projects/[id]/+page.server.ts | 2 +- src/routes/projects/[id]/+page.svelte | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'src/routes/projects/[id]') diff --git a/src/routes/projects/[id]/+page.server.ts b/src/routes/projects/[id]/+page.server.ts index 7cb90ff..19aea9b 100644 --- a/src/routes/projects/[id]/+page.server.ts +++ b/src/routes/projects/[id]/+page.server.ts @@ -26,7 +26,7 @@ export const load: PageServerLoad = async ({ params }) => { if (!project || project.archived) { throw error(404, 'Projet introuvable'); } - const dashboard = await loadProjectDashboard(id, Date.now()); + const dashboard = await loadProjectDashboard(id, Temporal.Now.instant()); const archived = await loadArchived(id); return { project: { id: project.id, name: project.name }, diff --git a/src/routes/projects/[id]/+page.svelte b/src/routes/projects/[id]/+page.svelte index a58aeba..9931f40 100644 --- a/src/routes/projects/[id]/+page.svelte +++ b/src/routes/projects/[id]/+page.svelte @@ -9,6 +9,7 @@ parseIntervalToDays, type RoutineState, } from '$lib/shared/routine-metrics'; + import { formatDayMonth } from '$lib/shared/temporal'; let { data, form } = $props(); @@ -30,11 +31,6 @@ : matchItems(data.archived, archiveFilter).map((m) => m.obj), ); - const dateFormatter = new Intl.DateTimeFormat('fr-FR', { - day: 'numeric', - month: 'short', - }); - function sorted(routines: RoutineState[]): RoutineState[] { return [...routines].sort( (a, b) => b.overdueRatio - a.overdueRatio || a.name.localeCompare(b.name), @@ -182,7 +178,7 @@ {formatFrequency(routine.frequencyDays)} {#if routine.lastDoneAt} - · fait le {dateFormatter.format(new Date(routine.lastDoneAt))} + · fait le {formatDayMonth(routine.lastDoneAt)} {:else} · jamais fait {/if} @@ -244,7 +240,7 @@ > {formatFrequency(routine.frequencyDays)} · archivée le - {dateFormatter.format(new Date(routine.archivedAt))} + {formatDayMonth(routine.archivedAt)} {/each} -- cgit v1.3